<?php

/**
 * @category   MM
 * @package    MM_Service
 */
class MM_Service_Admin_EventUserFavorite extends Mediad2_Service_Abstract
{
	/**
	 * 初始化
	 */
	public function init()
	{
		$this->setMapper('MM_Mapper_EventUserFavorite');
		$this->setModel('MM_Model_EventUserFavorite');
	}
	
	/**
	 * 指定用户是否已“Fav”指定文件
	 * @param int $eid
	 * @param int $uid
	 * @param string $objecttype
	 * @param int $objectid
	 * @return boolean
	 */
	public function isFavored($eid, $uid, $objecttype, $objectid)
	{
		$where = "eid = $eid AND uid = $uid AND objectid = $objectid AND objecttype = '$objecttype'"; //存在于event_user_favorite表
		$row = $this->getMapper()->getCount($where);
		if (empty($row)) {
			return false;
		} else {
			return true;
		}
	}
	
}